<?php
session_start();
include('includes/db/sql.functions.php');
ob_start();
$query=get_all_biobits();


if(isset($_SESSION["errores"])){ 
	$errorname=$_SESSION["errores"];
	
}else{
	
	$errorname="";
}
?>
<script	type="text/javascript" src="js/validaciones.js"></script>
<script> 

$(document).ready(function(){
	
        $(function() {
                $( "#dialog" ).dialog({
                                        autoOpen: false,
                                        width: 600,
                                        buttons: {
                                                "Ok": function() { 
                                                        $(this).dialog("close"); 
                                                }, 
                                                
                                        }
                                });

                        $('#dialog_link').click(function(){
                                        $('#dialog').dialog('open');
                                        return false;
                                });
                        $(".botonMolon").button();
        });



                $( "input:submit, a, button", ".botonMolon" ).button();
                $( "a", ".demo" ).click(function() { return false; });


	

        
});</script>

<?php
//AUTOCOMPLETADO
echo "<script>
        $(function() {
                var availableTags = [";

foreach($query['query'] as $clave => $valor){
	$a=$query['query'][$clave]['bb_name'];
	$otroarry =end($query['query']);
	if($otroarry['bb_name']==$a ){
		echo  "'".$a."'";

	}else{
		echo "'".$a."'".",";

	}
}

echo "];
                $( '#bbname' ).autocomplete({
                        source: availableTags
                });
        });
        </script>";            

//FIN AUTOCOMPLETADO
?>



<div id="error"></div>
<div id="dialog" title="Basic dialog">
<p>Be careful when introducing the name of the BioBit, use the standard
notation.</p>
<p>For example: type "3-OXO-C6" instead of
"N-(3-oxo-hexanoyl)-L-homoserine lactone" with capital letters</p>
</div>
<div id="DivBiobitForm">

<fieldset>
<legend>Biobit</legend>
<form id="biobitForm" onsubmit="return val_sbb()" action="searchbiobitVal.php" method="post">


<div class="ui-widget">
<div class="ui-state-highlight ui-corner-all"
	style="margin-top: 20px; padding: 0 .7em;">
<p><span class="ui-icon ui-icon-info"
	style="float: left; margin-right: .3em;"></span> <strong>Hey!</strong>
Please check the typing rules. Click <a href="#" id="dialog_link">here!</a>
</p>
</div>
</div>
</br>

<div id="div_bb">

<label id="label_name" for="name">BioBit name:</label>

<input id="bbname" name="bbname" type="text" value="" />
<?php 
	if($errorname){
		?>
		<span id="span_bb_name"  class="errorForm";><?php echo $errorname;?></span>
        <?php
	}else{
		?>
		<span id="span_bb_name">Type the biobit asociated to wire</span>
        <?php	
	}
	?>
</div>

<input id="botonsub" class="botonMolon" type="submit" value="Send" />

</form>

</fieldset>

</div>


<?php
$content= ob_get_contents();
ob_end_clean();
include_once('template.php');

?>
